<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@taglib prefix="s" uri="/struts-tags"%>
<%@ page import="zozopo.operations.comm.*" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>


<!DOCTYPE HTML>
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>修改产品  - 仓库管理</title>
    <script type='text/javascript' src="<%=basePath %>jquery/jquery-1.4.2.js"></script>
	<script type='text/javascript' src="<%=basePath %>warehouse/js/ajaxupload.js"></script>
	<style>
	div.preview { float: left; width: 60px; height: 60px; border: 2px dotted #CCCCCC; }
	div.preview.loading { background: url(<%=basePath %>warehouse/image/loading.gif) no-repeat 19px 20px; }
	div.preview.loading img {display: none; }
	</style>
	
	<script>
 
	
$(document).ready(function(){

	var thumb = $('img#thumb');	

	new AjaxUpload('file', {
		action: $('form#newHotnessForm').attr('action'),
		name: 'file',
		data: {goodsid:'<s:property value="goods.id_goods"/>'}, 
		onSubmit: function(file, extension) {
			$('div.preview').addClass('loading');
		},
		onComplete: function(file, response) {
			response = response.replace('<PRE>','');
			response = response.replace('</PRE>','');
			response = '<%=basePath %>' + response;
			$('div.preview').removeClass('loading');
			thumb.unbind();
			thumb.attr('src', response);
			//alert(response);
			alert("成功修改!");
		}
	});
	});
		
		
	</script>
  </head>
  <style>
	<!--
	table {
	table-layout: fixed;
	word-wrap:break-word;
	}
	td{
		
		word-break:break-all;
	}
	
	BODY {
	PADDING-RIGHT: 0px; PADDING-LEFT: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-TOP: 0px; FONT-FAMILY: arial,san serif
}
	//-->
</style>
  <body>
  
  <table width="100%"  border="0" cellpadding="0" cellspacing="0" height="100%">
  	<tr>
  		<td valign="top">
  			<jsp:include page="/background/head.jsp"></jsp:include>
  		</td>
  	</tr>
  	<tr>
  		<td valign="top">
  			<table width="100%"  border="0" cellpadding="0" cellspacing="0">
  
 		<tr>
    	<td width="270" align="center">
    		
    	</td>
    	<td width="100%">
    		
    		
    		
    	</td>
    </tr>
    
    <tr>
    	<td valign="top">
     		<div>
     		
     		</div>
		  	<jsp:include page="/background/left.jsp"></jsp:include>
				 
				 
				
     	</td>
     	
     	
     	<td valign="top" >
     <table border="0" cellpadding="0" cellspacing="0" >
    	 <tr>
     		<td>
     	
     	</td>
     		</tr>
 <tr>
     		<td>
     		
     		
     		
     		
     		

				
     <table border="0" cellpadding="0" cellspacing="0"  width="100%">
    	 <tr>
     		<td width="100%">
     		
     		
     		
     	<table width="100%" border="0" cellpadding="0" bgcolor="#e5f3ff" cellspacing="0" style= "border:1px solid #ffffff; border-top-color:#6cb1f1;">
     		
     		<tr>
     			<td>修改产品
     			<input type="button" value="查看谁有权限" 
     				onclick="javascript:openUrlForDialog('selectoperatorlimitedAction_background.action?limitedCode=<s:property value="limitedcode"/>')"/>
     			</td>
     			
     			
     		</tr>
     	</table>
     	
     	<table border="0" cellpadding="0"  cellspacing="0" width="100%"  style= "border:1px solid #ffffff;" >
     			<tr >
					
						<td width="105"  >商品图片:</td>
						<td>
						
						<div class="column-row">
							<div class="seven columns">
								<div class="preview">
									<img id="thumb" width="60px" height="60px" src="<s:property value="goods.image_goods"/>" />
								</div>
				
								<span class="wrap hotness">
									<form id="newHotnessForm" action="<%=basePath %>warehouse/uploadgoodsimage_warehouse.action" >
										选要上传的图片不能超过512KB<br>
										<input type="file" id="file" name="file" size="20" />
										
									</form>
								</span> 
							</div>
						</td>
						<td></td>
					</tr>
     		</table>
     	</td>
     		</tr>
 		<tr>
     		<td>
     			<FONT color="red"><s:property value="operationResult"/></FONT>
     			<s:fielderror id="errormessage" />
     			<br/>
     			
     			
     		<form action="warehouse/modifygoods_warehouse.action" method="post" accept-charset="UTF-8" id="modifygoods_warehouseForm" name="modifygoods_warehouseForm"> 
				<s:token />
				<table border="0" cellpadding="0"  cellspacing="0" width="100%"  style= "border:1px solid #ffffff;" class="bottomline">
					<tr>
					
						<td width="100">商品ID:</td>
						<td><s:property value="goods.id_goods"/> 
						<input name="id_goods" id="id_goods" type="hidden" value="<s:property value="goods.id_goods"/>" />
						
						</td>
						<td ></td>
					</tr>
					
					
					
					<tr>
					
						<td width="100">商品名称:</td>
						<td ><input type="text" id="name_goods" name="name_goods" size="40" maxlength="128" value="<s:property value="goods.name_goods"/>"/></td>
						<td ></td>
					</tr>
					
					
					
					<tr>
					
						<td>单位:</td>
						<td><input type="text" id="unit_goods" name="unit_goods" size="10" maxlength="32" value="<s:property value="goods.unit_goods"/>"/></td>
						<td></td>
					</tr>
					
					<tr>
					
						<td>商品条码:</td>
						<td><input type="text" id="barcode_goods" name="barcode_goods" size="20" maxlength="32" value="<s:property value="goods.barcode_goods"/>"/></td>
						<td></td>
					</tr>
					
					
					
					<tr>
					
						<td>商品重量(kg):</td>
						<td><input type="text" id="kg_goods" name="kg_goods" size="50" maxlength="320" value="<s:property value="goods.kg_goods"/>"/></td>
						<td></td>
					</tr>
					
					<tr>
					
						<td>商品介绍连接:</td>
						<td><input type="text" id="url_goods" name="url_goods" size="50" maxlength="320" value="<s:property value="goods.url_goods"/>"/></td>
						<td></td>
					</tr>
					
					
					<tr>
					
						<td>商品类别:</td>
						<td>
							<s:iterator id="goodsclassMap" value="goodsclassMap"> 
							
								
									
									<s:if test="value.parentid_goodsclass == 0">
									
										<br/>
									</s:if>
									
									<s:if test="goodsclasslistMap.get(value.id_goodsclass) != null">
										<input type="checkbox" id="goodsclassid_goodsclasslist" name="goodsclassid_goodsclasslist" value="<s:property value="value.id_goodsclass"/>" checked="checked"> <s:property value="value.name_goodsclass"/></input>
										
									</s:if>
									<s:else>
										<input type="checkbox" id="goodsclassid_goodsclasslist" name="goodsclassid_goodsclasslist" value="<s:property value="value.id_goodsclass"/>"> <s:property value="value.name_goodsclass"/></input>
									</s:else>
										
									
									
									<s:if test="value.parentid_goodsclass == 0">
									
										<br/>
									</s:if>
							</s:iterator>
							<input type="hidden" id="goodsclassjson" name="goodsclassjson"/>
						</td>
						<td></td>
					</tr>
					
					
					
					<tr>
						<td>描述/备注:</td>
						<td><textarea id="remark_goods" name="remark_goods"><s:property value="goods.remark_goods"/></textarea></td>
						<td></td>
					</tr>
					

				</table>
			</form>

	</td>
     		</tr>
     		 <tr>
     		<td>
     			<button type="button" onclick="modifygoodsSubmit()">修改</button>
		
     	</td>
     	</tr>
     	
     	
     	
     	</table>
     	
	</td>
     		</tr>
     		 <tr>
     		<td>
     		
		
     	</td>
     	</tr>
     	
     	
     	
     	</table>
	</td>
</tr>

</table>
  		</td>
  	</tr>
  	<tr>
  		<td valign="bottom">
  			<jsp:include page="/background/tail.jsp"></jsp:include>
  		
  		</td>
  	</tr>
  
  </table>
  </body>
  <script type="text/javascript">
  
  function modifygoodsSubmit(){
		var limitJSON = "[";
		var i=0;
		var limitedLength = $('input:checked').size();
		$('input:checked').each(function(i){
			 //alert($(this).val());
			 
			 limitJSON += "'" + $(this).val()+"'";
			 if((i+1)!=limitedLength){
				 limitJSON += ",";
			 }
			 i++;
		});
		limitJSON +="]";
		
		$("#goodsclassjson").attr('value',limitJSON);
		
		modifygoods_warehouseForm.submit();
}
  </script>
</html>
